<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateShopCartTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('shop_cart')) {
            //购物车
            Schema::create('shop_cart', function(Blueprint $table) {
                $table->increments('id')->comment('地址标识');
                $table->integer('user_id')->default(0)->comment('用户标识');
                $table->integer('goods_id')->default(0)->comment('商品id');
                $table->integer('goods_spu_id')->default(0)->comment('商品属性id');
                $table->decimal('unit_price')->default(0)->comment('商品单价');
                $table->integer('num')->default(0)->comment('商品数量');
                $table->decimal('amount_money')->default(0)->comment('最终金额');
                $table->softDeletes();
                $table->timestamps();
            });
        }

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
